<script>
/**
 * vuex管理登陆状态，具体可以参考官方登陆模板示例
 */
import { mapMutations } from 'vuex'

// import mixins from '@/mixins/mixins.js'
export default {
  methods: {
    ...mapMutations(['login'])
  },
  mixins: {
    // mixins
  },
  onLaunch: function() {
    const userInfo = uni.getStorageSync('userInfo') || ''
    if(userInfo.openId) {
      // 更新登陆状态
      uni.getStorage({
        key: 'userInfo',
        success: (res) => {
          this.login(res.data)
        }
      })
    }
  },
  onShow: function() {
    console.log('App Show')
  },
  onHide: function() {
    // console.log('App Hide')
  },
}
</script>

<style lang='scss'>

</style>
